import React, { memo } from "react";
import { EventCommentWrap } from "./style";
import { getSizeImage, getMonthDayHouMin } from "@/utils/format-utils";
import Event from "@/components/user/event";
// import {getCommentEvent} from '@/services/user'

export default memo(function EventComment(props) {
  const getComment = (id) => {};
  return (
    <EventCommentWrap>
      <div key={props.item.id} className="userEventBox">
        <div className="userEventBoxImg">
          {props.userDetailInfo ? (
            <img
              src={
                props.userDetailInfo.code == 200
                  ? getSizeImage(props.userDetailInfo.profile.avatarUrl, 45)
                  : ""
              }
              alt=""
            />
          ) : (
            <img src={getSizeImage(props.item.user.avatarUrl, 45)} alt="" />
          )}
        </div>
        <div className="userEventBoxRight">
          <div className="userEventTitle">
            {props.userDetailInfo ? (
              <a>
                {props.userDetailInfo.code == 200
                  ? props.userDetailInfo.profile.nickname
                  : ""}
              </a>
            ) : (
              <a href="#/">{props.item.user.nickname}</a>
            )}

            <span className="userMusic icon2"></span>
            {props.item.type == 18 ? (
              <span style={{ fontSize: "14px" }}>分享单曲</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 17 ? (
              <span style={{ fontSize: "14px" }}>分享节目</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 28 ? (
              <span style={{ fontSize: "14px" }}>分享节目</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 19 ? (
              <span style={{ fontSize: "14px" }}>分享专辑</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 39 ? (
              <span style={{ fontSize: "14px" }}>发布视频</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 22 ? (
              <span style={{ fontSize: "14px" }}>转发</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 21 ? (
              <span style={{ fontSize: "14px" }}>分享MV</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 36 ? (
              <span style={{ fontSize: "14px" }}>分享歌手</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 13 ? (
              <span style={{ fontSize: "14px" }}>分享歌单</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 35 ? (
              <span style={{ fontSize: "14px" }}>分享歌单</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
            {props.item.type == 56 ? (
              <span style={{ fontSize: "14px" }}>分享网页</span>
            ) : (
              <React.Fragment></React.Fragment>
            )}
          </div>
          <div className="userEventTime">
            {getMonthDayHouMin(props.item.eventTime)}
          </div>
          <div className="userEventContent">
            {JSON.parse(props.item.json)
              .msg.split("\n")
              .map((itema, indexa) => {
                return <p key={indexa}>{itema}</p>;
              })}
          </div>
          <div className="json-text">
            <Event
              open={props.open}
              indexNum={props.num}
              dzimg={props.item.info.commentThread.latestLikedUsers}
              id={props.item.info.commentThread.id}
              userId={props.item.user.userId}
              getComment={(e) => getComment(props.item.info.commentThread.id)}
              type={props.item.type}
              itemValue={props.item}
            />
          </div>
        </div>
      </div>
    </EventCommentWrap>
  );
});
